<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>应急信息发布项目审核</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link href="../../layui/css/layui.css" rel="stylesheet" type="text/css">
    <link href="../../css/style.css" rel="stylesheet" type="text/css">
    <link href="../../css/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" type="text/css">
    <script src="../../layui/layui.js"></script>
    <script src="../../js/jquery-1.8.3.js"></script>
    <script src="../../js/util.js"></script>
    <script src="../../js/jquery-ui-1.10.4.custom.min.js"></script>
    <style type="text/css">
        #check{
            color: #0000FF ;
        }
    </style>
    <script>
        layui.use(['table', 'form', 'jquery', 'element','layer'], function () {

            var table = layui.table;
            var form = layui.form;
            var $ = layui.$;
            var layer=layui.layer;
            var  user;
            var options = {
                elem: "#table",
                id: "modelReload",
                url: '/xuYiLinePointCheck/qryLinePointCheckInfo',
                method: 'post',
                contentType:"application/json;charset=UTF-8",
                request: {
                    pageName: 'page',
                    limitName: 'limit'
                },
                where: {
                    checkState: $('#templateState').val(),
                    checkType: $('#checkType').val()
                },
                response: {
                    statusName: 'code',
                    statusCode: 0,
                    msgName: 'msg',
                    countName: 'count',
                    dataName: 'data'
                },
                loading: true,
                page: {
                    count: "count",
                    limit: 10,
                    limits: [10, 20, 50],
                    layout: ['prev', 'page', 'next', 'skip', 'limit', 'count'],
                    prev: "上一页",
                    next: "下一页",
                    groups: 5
                },
                cols: [[ //表头
                    {field: 'typeName', title: '审核类型',align:"center",width: '15%'},
                    {field: 'operator', title: '操作人',align:"center",width: '15%'},
                    {field: 'createTime', title: '创建时间',align:"center",width: '15%'},
                    {field: 'checkOperator', title: '审核人',align:"center",width: '15%'},
                    {field: 'modifyTime', title: '审核时间',align:"center",width: '15%'},
                    {field: 'checkState', title: '审核状态',align:"center",width: '10%', templet:function(d){
                            if(d.checkState=='0'){
                                return '<div style="color:blue;">待审核</div>'
                            }else if(d.checkState=='1'){
                                return '<div style="color:green;">审核通过</div>'
                            }else if(d.checkState=='2'){
                                return '<div style="color:red;">审核不通过</div>'
                            }
                        }},


                    {field: 'operation', title: '操作',align:"center",templet: addLink}
                ]],
                done: function (data) {
                }
            };
    		table.render(options);
            function addLink(d) {
                var checkState = d.checkState;
                var checkId = d.checkId;
                console.info(user.duty);
                var path = "xuYiLinePointCheck.html?checkId="+checkId+"&userDuty="+user.duty;
                console.info(path);
                if (checkState==0) {
                    return '<a href="#" lay-event="check" id="check">审核详情</a>';
                } else {
                    return '<a href="#" lay-event="check" id="check">审核详情</a>';
                }
            }
            //更新数据表
            $('#query').on('click', function () {

                    var index = layer.load(1, {
                        shade: [0.1,'#fff'] //0.1透明度的白色背景
                    });
                    table.render(options);
                    table.reload('modelReload', {
                        method: 'post',
                        page: {
                            curr: 1
                        },
                        where: {
                            checkState: $('#templateState').val(),
                            checkType: $('#checkType').val()
                        }
                    });
                    layer.close(index);

            });

            table.on('tool(tableElement)', function (obj) {
                var data = obj.data;
                window.location.href = 'xuYiLinePointCheck.html?checkId=' + data.checkId;
            });

            function  findUserDuty() {
                $.ajax({
                    type: 'post',
                    async: false,
                    url: '/util/findUser',
                    success: function (json) {
                        user=json;
                    }, error: function () {
                        layer.msg('系统异常，请联系管理员处理!');
                    }
                });
            }
            //身份识别
            $(document).ready(function () {
                findUserDuty();
            });

        });

    </script>
    <script type="text/html" id="barDemo">
        <a href="#" lay-event="check" id="check">审核</a>
    </script>
</head>
<body>
<div class="layui-content-body">
    <div class="scroll-box">
        <div class="breadcrumb-box">
              <span class="layui-breadcrumb" lay-separator="|">
      <a href="javascript:returnIndex2()">首页&nbsp;</a>
  <a href="#">线路点位审核</a>
</span>
        </div>
        <div class="content-box">
            <div class="form-select-box">
                <div class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">审核类型</label>
                            <div class="layui-input-block" style="width:180px;margin-left:120px;">
                                <select id="checkType" name="checkType" lay-filter="checkType">
                                    <option value="">全部</option>
                                    <option value="1">点位新增</option>
                                    <option value="2">点位修改</option>
                                    <option value="3">点位删除</option>
                                    <option value="4">线路新增</option>
                                    <option value="5">线路修改</option>
                                    <option value="6">线路删除</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">审核状态</label>
                            <div class="layui-input-block" style="width:180px;margin-left:120px;"">
                                <select id="templateState" name="templateState" lay-filter="templateState">
                                    <option value="">全部</option>
                                    <option value="0">待审核</option>
                                    <option value="1" >审核通过</option>
                                    <option value="2">审核不通过</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <div class="layui-inline" pane="">
                                <button class="layui-btn layui-btn-normal" id="query">查&nbsp;询</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-table">
                <table id="table" lay-filter="tableElement"></table>
            </div>
        </div>
    </div>
</div>
</body>
</html>